package cn.golxen.rsms.redis;

import cn.golxen.rsms.commons.utils.CommonsUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

@Service
@Slf4j
public class RedisUtils {
    @Autowired
    RedisTemplate<String, String> redisTemplate;

    @Cacheable(value = "timer::suggested_price",key = "#code")
    public String timerSuggestedPrice(String code) {
        log.info("设置timer::suggested_price"+code+"同步计时");
        return "1";
    }

    @Cacheable(value = "mail_code",key = "#userId")
    public String getMailCode(String userId){
        return CommonsUtils.randomCode();
    }

}
